<?php

class Tablas extends CI_Controller {
	
	var $controlador = "tablas";

	public function __construct(){
		parent::__construct();
	}
	
	public function index()	{}
	
	public function info_tabla_bbdd(){
		$this->load->model('bbddDao');
		$bbdd = $this->uri->segment(3);
		$tabla = $this->uri->segment(4);
		
		$data['bbdd'] = $bbdd;
		$data['tabla'] = $tabla;
		$data['campos_tabla'] = $this->bbddDao->getNombreCamposTabla($bbdd,$tabla);
		$this->load->view($this->controlador.'/info_tabla_bbdd',$data);
	}
	
	public function info_registro_tabla(){
		$this->load->model('bbddDao');
		$bbdd = $this->uri->segment(3);
		$tabla = $this->uri->segment(4);
		$id_registro = $this->uri->segment(5);
		
		$data['bbdd'] = $bbdd;
		$data['tabla'] = $tabla;
		$data['id_registro'] = $id_registro;
		$data['id_div'] = $bbdd."_".$tabla."_".$id_registro;
		$data['campos'] = $this->bbddDao->getNombreCamposTabla($bbdd,$tabla);
		$data['info_registro'] = $this->bbddDao->getRegistroTabla($bbdd,$tabla,$id_registro);
		
		$this->load->view($this->controlador.'/info_registro_tabla',$data);
	}
	
	public function nuevo_registro_tabla(){
		$this->load->model('bbddDao');
		$bbdd = $this->uri->segment(3);
		$tabla = $this->uri->segment(4);
	
		$data['bbdd'] = $bbdd;
		$data['tabla'] = $tabla;
		$data['id_div'] = $bbdd."_".$tabla;
		$data['campos'] = $this->bbddDao->getNombreCamposTabla($bbdd,$tabla);
		$this->load->view($this->controlador.'/nuevo_registro_tabla',$data);
	}
		
}

?>